<template>
  <div>
    <el-form
      ref="postForm"
      :model="postForm"
      :rules="rules"
      label-width="200px"
      label-suffix=":"
    >
      <sticky :z-index="10" :class-name="'sub-navbar ' + postForm.status">
        <el-button v-loading="loading" style="margin-left: 10px;" type="success" @click="submitForm">
          保存
        </el-button>
      </sticky>

      <div style="padding: 15px">
        <el-row>
          <el-col :span="22">
            <el-form-item label="体验官司金额" style="width: 500px">
              <el-input v-model="postForm.vip1" />
            </el-form-item>
            <el-form-item label="社区店套数" style="width: 500px">
              <el-input v-model="postForm.vip2" />
            </el-form-item>
            <el-form-item label="县区店套数" style="width: 500px">
              <el-input v-model="postForm.vip3" />
            </el-form-item>
            <el-form-item label="市级店套数" style="width: 500px">
              <el-input v-model="postForm.vip4" />
            </el-form-item>
            <el-form-item label="省级店套数" style="width: 500px">
              <el-input v-model="postForm.vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆套数" style="width: 500px">
              <el-input v-model="postForm.vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip1" />
            </el-form-item>
            <el-form-item label="社区店 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip2" />
            </el-form-item>
            <el-form-item label="县区店 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip3" />
            </el-form-item>
            <el-form-item label="市级店 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip4" />
            </el-form-item>
            <el-form-item label="省级店 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆 - 销售奖" style="width: 500px">
              <el-input v-model="postForm.r_vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 管理奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.m_vip1" />
            </el-form-item>
            <el-form-item label="社区店 - 管理奖" style="width: 500px">
              <el-input v-model="postForm.m_vip2" />
            </el-form-item>
            <el-form-item label="县区店 - 管理奖" style="width: 500px">
              <el-input v-model="postForm.m_vip3" />
            </el-form-item>
            <el-form-item label="市级店 - 管理奖" style="width: 500px">
              <el-input v-model="postForm.m_vip4" />
            </el-form-item>
            <el-form-item label="省级店 - 管理奖" style="width: 500px">
              <el-input v-model="postForm.m_vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆 - 管理奖" style="width: 500px">
              <el-input v-model="postForm.m_vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip1" />
            </el-form-item>
            <el-form-item label="社区店 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip2" />
            </el-form-item>
            <el-form-item label="县区店 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip3" />
            </el-form-item>
            <el-form-item label="市级店 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip4" />
            </el-form-item>
            <el-form-item label="省级店 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆 - 推荐包裹" style="width: 500px">
              <el-input v-model="postForm.b_vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="区代 - 地区包裹" style="width: 500px">
              <el-input v-model="postForm.a_vip1" />
            </el-form-item>
            <el-form-item label="市代 - 地区包裹" style="width: 500px">
              <el-input v-model="postForm.a_vip2" />
            </el-form-item>
            <el-form-item label="省代 - 地区包裹" style="width: 500px">
              <el-input v-model="postForm.a_vip3" />
            </el-form-item>
            <el-form-item label="市级店 - 地区包裹" style="width: 500px" v-if="false">
              <el-input v-model="postForm.a_vip4" />
            </el-form-item>
            <el-form-item label="省级店 - 地区包裹" style="width: 500px" v-if="false">
              <el-input v-model="postForm.a_vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆 - 地区包裹" style="width: 500px" v-if="false">
              <el-input v-model="postForm.a_vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip1" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="社区店 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip2" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="县区店 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip3" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="市级店 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip4" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="省级店 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip5" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 分红比例" style="width: 500px">
              <el-input v-model="postForm.p_vip6" />
              <span>百分比%</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip1" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="社区店 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip2" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="县区店 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip3" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="市级店 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip4" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="省级店 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip5" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 分红上限" style="width: 500px">
              <el-input v-model="postForm.px_vip6" />
              <span>倍数</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip1" />
              <span>折扣</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip2" />
              <span>折扣</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip3" />
              <span>折扣</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip4" />
              <span>折扣</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip5" />
              <span>折扣</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购折扣" style="width: 500px">
              <el-input v-model="postForm.re_vip6" />
              <span>折扣</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购销售奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_r_vip1" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购销售奖" style="width: 500px">
              <el-input v-model="postForm.re_r_vip2" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购销售奖" style="width: 500px">
              <el-input v-model="postForm.re_r_vip3" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购销售奖" style="width: 500px">
              <el-input v-model="postForm.re_r_vip4" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购销售奖" style="width: 500px">
              <el-input v-model="postForm.re_r_vip5" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购销售奖" style="width: 500px">
              <el-input v-model="postForm.re_r_vip6" />
              <span>百分比%</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购服务奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_m_vip1" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购服务奖" style="width: 500px">
              <el-input v-model="postForm.re_m_vip2" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购服务奖" style="width: 500px">
              <el-input v-model="postForm.re_m_vip3" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购服务奖" style="width: 500px">
              <el-input v-model="postForm.re_m_vip4" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购服务奖" style="width: 500px">
              <el-input v-model="postForm.re_m_vip5" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购服务奖" style="width: 500px">
              <el-input v-model="postForm.re_m_vip6" />
              <span>百分比%</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购平级奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_e_vip1" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购平级奖" style="width: 500px">
              <el-input v-model="postForm.re_e_vip2" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购平级奖" style="width: 500px">
              <el-input v-model="postForm.re_e_vip3" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购平级奖" style="width: 500px">
              <el-input v-model="postForm.re_e_vip4" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购平级奖" style="width: 500px">
              <el-input v-model="postForm.re_e_vip5" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购平级奖" style="width: 500px">
              <el-input v-model="postForm.re_e_vip6" />
              <span>百分比%</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="区代 - 复购地区包裹奖" style="width: 500px">
              <el-input v-model="postForm.re_b_vip1" />
            </el-form-item>
            <el-form-item label="市代 - 复购地区包裹奖" style="width: 500px">
              <el-input v-model="postForm.re_b_vip2" />
            </el-form-item>
            <el-form-item label="省代 - 复购地区包裹奖" style="width: 500px">
              <el-input v-model="postForm.re_b_vip3" />
            </el-form-item>
            <el-form-item label="市级店 - 复购地区包裹奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_b_vip4" />
            </el-form-item>
            <el-form-item label="省级店 - 复购地区包裹奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_b_vip5" />
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购地区包裹奖" style="width: 500px" v-if="false">
              <el-input v-model="postForm.re_b_vip6" />
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip1" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip2" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip3" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip4" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip5" />
              <span>百分比%</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购分红" style="width: 500px">
              <el-input v-model="postForm.re_p_vip6" />
              <span>百分比%</span>
            </el-form-item>
            <el-divider></el-divider>
            <el-form-item label="体验官 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip1" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="社区店 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip2" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="县区店 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip3" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="市级店 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip4" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="省级店 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip5" />
              <span>倍数</span>
            </el-form-item>
            <el-form-item label="大区体验馆 - 复购分红上限" style="width: 500px">
              <el-input v-model="postForm.re_px_vip6" />
              <span>倍数</span>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </el-form>
  </div>
</template>

<script>
import Sticky from '@/components/Sticky'
import api from '@/api'
export default {
  name: 'SystemFlow',
  components: {
    Sticky
  },
  data() {
    return {
      postForm: {
        status: 'draft'
      },
      rules: {
      },
      loading: false
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    async fetchData() {
      const { data } = await api.member.fetchSet()
      this.postForm = Object.assign({}, data)
      this.postForm.status = 'publisher'
    },
    submitForm() {
      this.$refs.postForm.validate(validate => {
        if (validate) {
          this.loading = true
          api.member.saveSet({
            ...this.postForm
          }).then(response => {
            this.$notify({
              title: '成功',
              message: response.message || '保存成功',
              type: 'success',
              duration: 2000
            })
            this.loading = false
          }).catch(() => {
            this.loading = false
          })
        }
      })
    }
  }
}
</script>
